Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the mila init and mila code commands on windows & WSL #65

Merged
merged 26 commits into from
Nov 11, 2023

Conversation

@lebrice lebrice changed the title (WIP) Fix the mila init command on windows Fix the mila init command on windows Nov 6, 2023
@lebrice lebrice marked this pull request as ready for review November 6, 2023 20:06
milatools/cli/code_command.py Outdated Show resolved Hide resolved
milatools/cli/commands.py Outdated Show resolved Hide resolved
milatools/cli/commands.py Outdated Show resolved Hide resolved
milatools/cli/commands.py Outdated Show resolved Hide resolved
milatools/cli/commands.py Outdated Show resolved Hide resolved
@lebrice lebrice requested a review from breuleux November 8, 2023 17:21
@lebrice lebrice changed the title Fix the mila init command on windows Fix the mila init and mila code command on windows & WSL Nov 8, 2023
@lebrice lebrice changed the title Fix the mila init and mila code command on windows & WSL Fix the mila init and mila code commands on windows & WSL Nov 8, 2023
Signed-off-by: Fabrice Normandin <[email protected]>
Signed-off-by: Fabrice Normandin <[email protected]>
Signed-off-by: Fabrice Normandin <[email protected]>
Signed-off-by: Fabrice Normandin <[email protected]>
Signed-off-by: Fabrice Normandin <[email protected]>
Signed-off-by: Fabrice Normandin <[email protected]>
@lebrice
Copy link
Collaborator Author

lebrice commented Nov 8, 2023

Hmm I just realized there's one last thing that might need fixing:

  • If people run mila init inside WSL, then the ssh key setup is only done on the Ubuntu side, but the code command is actually run on the Windows side through Powershell!

Signed-off-by: Fabrice Normandin <[email protected]>
@lebrice lebrice requested a review from breuleux November 8, 2023 21:26
@lebrice
Copy link
Collaborator Author

lebrice commented Nov 9, 2023

Ready for review again @breuleux

Signed-off-by: Fabrice Normandin <[email protected]>
@@ -206,6 +261,7 @@ def _add_ssh_entry(
ssh_config: SSHConfig,
host: str,
Host: str | None = None,
*,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the * is doing? Is it to grab all extra args? Should an exception be thrown instead?

Copy link
Collaborator Author

@lebrice lebrice Nov 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's making it so _space_before and _space_after cannot be passed as positional arguments. This helps remove a typing error when calls to _add_ssh_entry are made with different **kwargs (Windows vs non-Windows)

Copy link
Collaborator Author

@lebrice lebrice Nov 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for reference: image

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah get it thanks

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we, should we assert that nothing is in this *?

def ... , *_args, ...:
    assert not _args

Only thinking out loud here

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly! That's what using a * without a name does

@lebrice lebrice merged commit 270e3c4 into mila-iqia:master Nov 11, 2023
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment